package org.carabiner.infinitest.swingui;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.ImageIcon;

import org.carabiner.infinitest.InfinitestCore;
import org.carabiner.infinitest.depgraph.DependencyGraph;

/**
 * 
 * @author <a href="mailto:benrady@gmail.com"Ben Rady</a>
 */
class ReloadIndexAction extends AbstractAction
{
  private InfinitestCore core;
  
  public ReloadIndexAction(InfinitestCore infinitestCore)
  {
    Icon icon = new ImageIcon(ResultTreeNode.class.getResource("reload.png"));
    putValue(Action.SMALL_ICON, icon);
    putValue(Action.SHORT_DESCRIPTION, "Force rebuild of dependency graph");
    core = infinitestCore;
  }  
  
  public void actionPerformed(ActionEvent e)
  {   
    core.reload();    
  }
}
